<?php

$studentId = $_POST['student_id'] ?? '';
$studentName = $_POST['student_name'] ?? '';
$studentSex = $_POST['student_sex'] ?? '';
$studentBirthday = $_POST['student_birthday'] ?? '';
$studentAddress = $_POST['student_address'] ?? '';
$classId=$_POST['class_id'] ??'';
var_dump($classId);

// 修改班级id为$classId，他的信息为新的信息
$dsn = "sqlsrv:Server=localhost;Database=Student";
$db = new PDO($dsn, "sa", "123456");

$sql = "update Student set StudentName='{$studentName}', 
                   StudentSex='{$studentSex}', StudentBirth='{$studentBirthday}', StudentAddress='{$studentAddress}',ClassId='{$classId}'
	where StudentId='{$studentId}'";
$result = $db->exec($sql);
if ($result) {
    echo '修改成功，前往<a href="student_list.php">列表页</a>';
} else {
    echo '修改失败';
}